﻿//-----------------------------------------------------------------------
// <copyright file="Copyright.cs" author="Michael Herndon">
//     Copyright (c) Company.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Amplify.CodeDom
{
	using System;
	using System.Collections.Generic;
	using System.CodeDom;
	using System.Linq;
	using System.Text;

	public static partial class Mixin
	{

		public static CodeNamespaceImport Add(this CodeNamespaceImportCollection unit, string nameSpace)
		{
			CodeNamespaceImport import = new CodeNamespaceImport(nameSpace);
			unit.Add(import);
			return import;
		}

		public static CodeNamespaceImport Using(this CodeNamespace unit, string nameSpace)
		{

			CodeNamespaceImport obj = new CodeNamespaceImport(nameSpace);
			unit.Imports.Add(obj);
			return obj;
		}

		public static CodeNamespaceImport AddImports(this CodeNamespace unit, string nameSpace)
		{
			CodeNamespaceImport obj = new CodeNamespaceImport(nameSpace);
			unit.Imports.Add(obj);
			return obj;
		}

		public static CodeNamespaceImport GetImport(this CodeNamespace unit, string nameSpace)
		{
			foreach (CodeNamespaceImport item in unit.Imports)
				if (item.Namespace == nameSpace)
					return item;
			return null;
		}
	}
}
